package dave.hibernate.lab;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

@Entity
@Table (name="EMPLOYEE", schema="test")
public class Employee{
	private String name;
	private String location;
	private int id;
	public Employee() { }
	public Employee(String a,String b){name=a;location=b;}
	public String getName(){ return name; }
	public void setName(String a){ name = a; }
	public String getLocation(){ return location; }
	public void setLocation(String b){ location = b; }
	
	@Id
	//@GeneratedValue
	@Column (name="ID")
	public int getId(){ return id; }
	public void setId(int s){ id = s; }


	public static void main(String[] args){
		//create a configuration object, reading from the hibernate.cf.xml file
		//Configuration config = new Configuration();
		Configuration config = new Configuration();
		//make sure hibernate aware of the User class
		config.addAnnotatedClass(Employee.class);
		//read and process hibernate.cfg.xml and JPA metadata
		config.configure();
		new SchemaExport(config).create(true,true);
	    
	}
}//end class